#include <ctime>
#include <iostream>
#include "NaiveTimer.h"
using namespace std;

NaiveTimer::NaiveTimer(void)
{
}


NaiveTimer::~NaiveTimer(void)
{
}

void NaiveTimer::start( void )
{
	startTime = (clock() + 0.0) / CLOCKS_PER_SEC;
}

void NaiveTimer::restart( void )
{
	startTime = (clock() + 0.0) / CLOCKS_PER_SEC;
}

double NaiveTimer::tillNow( void )
{
	double curTime = (clock() + 0.0) / CLOCKS_PER_SEC;
	return curTime - startTime;
}

double NaiveTimer::showTillNow(const string& s)
{
	double t = tillNow();
#ifdef _DEBUG
	cout << s << ": " << t << " seconds." << endl;
#endif

	return t;
}
